package Temp.杂乱无章;

public class 神奇的六位数 {
    public static void main(String[] args) {
        for (int i = 100000; i <200000 ; i++) {
            if(Shu(i,2)&&Shu(i,3)&&Shu(i,4)&&Shu(i,5)&&Shu(i,6)){
                System.out.println(i);
                break;
            }
        }
    }

    public static boolean Shu(int x,int y) {
        String s = x+"";
        char[] c = s.toCharArray();
        int[] arr = new int[10];
        for (int i = 0; i < 10; i++) {
            arr[i] =0;
        }
        for (int i = 0; i < 6; i++) {
            arr[c[i]-'0']++;
        }
        String h = (x*y)+"";
        char[] ch = h.toCharArray();
        for (int i = 0; i < 6; i++) {
            arr[ch[i]-'0']--;
        }
        for (int i = 0; i < 10; i++) {
            if (arr[i]!=0){
                return false;
            }
        }
        return true;
    }
}